
<!--查看审核记录的公用组件-->

<template>
  <div class="audit-records">
    <div v-for="(item,index) of records" :key="index">
      <Row class="records-row">
        <Col span="6">
          <p>任务环节：{{item.taskNode}}</p>
        </Col>
        <Col span="6" v-if="item.auditor">
          <p v-if="item.taskNode==='发起流程'">发起人：{{item.auditor}}</p>
          <p v-else-if="item.auditResult==='2'">处理人：{{item.auditor}}</p>
          <p v-else="item.auditor">审核人：{{item.auditor}}</p>
        </Col>
        <Col span="6">
          <p v-if="['1','0'].indexOf(item.auditResult)!==-1">审核结果：{{item.auditResult==='1'?'通过':'不通过'}}</p>
        </Col>
        <Col span="24" class="records-col">
          <p v-if="item.auditResult==='2'">处理：{{item.auditOpinion}}</p>
          <p v-else-if="item.auditResult">审核意见：{{item.auditOpinion}}</p>
        </Col>
      </Row>
      <Divider dashed />
    </div>
  </div>

</template>

<script>
import * as API from "@/api/bpmn-api.js";

export default {
  name: "audit-records",
  props:{
    businessId:{
      type:String,
      default:""
    }
  },
  data(){
    return{
      records:[]
    }
  },
  created() {
    this.getRecordsData()
  },
  methods:{
      getRecordsData(){
        API.getRecords({
          businessId:this.businessId
        }).then(res => {
          if (res.code==="0"){
            this.records = res.data
          }else {
            this.$Message.error(res.msg);
          }
        })
      }
  }
}
</script>

<style lang="less" scoped>
.audit-records{
  p{
    font-size: 14px;
  }
  .records-row{
    .records-col{
      padding-top: 8px;
    }
  }
}
</style>
